#include "window_down_menu.h"
#include "window_manager.h"

//lv_obj_t *ble_status_btn=NULL; 			//蓝牙状态按钮
//lv_obj_t *brightness_btn=NULL;				//蓝牙状态按钮
//lv_obj_t *DoNotDisturb_btn=NULL; 		//蓝牙状态按钮
//lv_obj_t *lock_status_btn=NULL; 			//蓝牙状态按钮
//lv_obj_t * power_btn=NULL; 					//蓝牙状态按钮
//lv_obj_t *progress_bar_btn=NULL; 		//蓝牙状态按钮
//lv_obj_t * setting_btn=NULL; 				//设置按钮

lv_obj_t* current_time=NULL;  //显示当前时间

Btn_Status_t Btn_menu[]=
{
[BLUTOOTH_STATUS]			={.status=false,},
[BRIGHTNESS_STATUS]		={.status=false,},	
[DO_NOTDISTURB_STATUS]={.status=false,},	
[LOCK_STATUS]					={.status=false,},
[POWER_STATUS]				={.status=false,},	
[SETTING_STATUS]			={.status=false,},

};

#if 0  //静态创建对象


//下拉菜单初始化处理
Down_Menu_t down_menu[]=
{
		[BLUTOOTH_STATUS]			={.status=false,.obj=NULL,.image_click=(void *)&blutooth_on,.image_release=(void *)  &blutooth_off,				.xpos=70+0*80,	.ypos=100+0*62,},
		[BRIGHTNESS_STATUS]		={.status=false,.obj=NULL,.image_click=(void *)&brightness_on,.image_release=(void *)&brightness_off,		.xpos=70+1*80,	.ypos=100+0*62,},
		[DO_NOTDISTURB_STATUS]={.status=false,.obj=NULL,.image_click=(void *)&DoNotDisturb,.image_release=(void *) &DoNotDisturb_off,	.xpos=70+2*80,	.ypos=100+0*62,},
		[LOCK_STATUS]					={.status=false,.obj=NULL,.image_click=(void *)&lock_on,.image_release=(void *)&      lock_off,								.xpos=70+0*80,	.ypos=100+1*80,},
		[POWER_STATUS]				={.status=false,.obj=NULL,.image_click=(void *)&power_off,.image_release=(void *)   & power_off,						.xpos=70+1*80,	.ypos=100+1*80,},
		[SETTING_STATUS]			={.status=false,.obj=NULL,.image_click=(void *)&setting,.image_release=(void *)&      setting,								.xpos=70+2*80,	.ypos=100+1*80,},

};


static void my_event_cb(lv_event_t * event)
{
	  //判断当前的对象
	  lv_obj_t * obj = lv_event_get_target(event);
	
	
	if(down_menu[BLUTOOTH_STATUS].obj == obj)
	{ 
		if(down_menu[BLUTOOTH_STATUS].status==false)
		{
			lv_img_set_src(down_menu[BLUTOOTH_STATUS].obj ,down_menu[BLUTOOTH_STATUS].image_click);						//设置背景图片
			down_menu[BLUTOOTH_STATUS].status=true;
		}else
		{
     lv_img_set_src(down_menu[BLUTOOTH_STATUS].obj ,down_menu[BLUTOOTH_STATUS].image_release);						//设置背景图片
	    down_menu[BLUTOOTH_STATUS].status=false;
		}
	}else	if(down_menu[BRIGHTNESS_STATUS].obj == obj)
	{ 
		if(down_menu[BRIGHTNESS_STATUS].status==false)
		{
			lv_img_set_src(down_menu[BRIGHTNESS_STATUS].obj ,down_menu[BRIGHTNESS_STATUS].image_click);						//设置背景图片
			down_menu[BRIGHTNESS_STATUS].status=true;
		}else
		{
     lv_img_set_src(down_menu[BRIGHTNESS_STATUS].obj ,down_menu[BRIGHTNESS_STATUS].image_release);						//设置背景图片
	    down_menu[BRIGHTNESS_STATUS].status=false;
		}
	}	
	else	if(down_menu[DO_NOTDISTURB_STATUS].obj == obj)
	{ 
		if(down_menu[DO_NOTDISTURB_STATUS].status==false)
		{
			lv_img_set_src(down_menu[DO_NOTDISTURB_STATUS].obj ,down_menu[DO_NOTDISTURB_STATUS].image_click);						//设置背景图片
			down_menu[DO_NOTDISTURB_STATUS].status=true;
		}else
		{
     lv_img_set_src(down_menu[DO_NOTDISTURB_STATUS].obj ,down_menu[DO_NOTDISTURB_STATUS].image_release);						//设置背景图片
	    down_menu[DO_NOTDISTURB_STATUS].status=false;
		}
	}	else	if(down_menu[LOCK_STATUS].obj == obj)
	{ 
		if(down_menu[LOCK_STATUS].status==false)
		{
			lv_img_set_src(down_menu[LOCK_STATUS].obj ,down_menu[LOCK_STATUS].image_click);						//设置背景图片
			down_menu[LOCK_STATUS].status=true;
		}else
		{
     lv_img_set_src(down_menu[LOCK_STATUS].obj ,down_menu[LOCK_STATUS].image_release);						//设置背景图片
	    down_menu[LOCK_STATUS].status=false;
		}
	}	

	else	if(down_menu[POWER_STATUS].obj == obj)
	{ 
		if(down_menu[POWER_STATUS].status==false)
		{
			lv_img_set_src(down_menu[POWER_STATUS].obj ,down_menu[POWER_STATUS].image_click);						//设置背景图片
			down_menu[POWER_STATUS].status=true;
		}else
		{
     lv_img_set_src(down_menu[POWER_STATUS].obj ,down_menu[POWER_STATUS].image_release);						//设置背景图片
	    down_menu[POWER_STATUS].status=false;
		}
	}	
	else	if(down_menu[SETTING_STATUS].obj == obj)
	{ 
		if(down_menu[SETTING_STATUS].status==false)
		{
			lv_img_set_src(down_menu[SETTING_STATUS].obj ,down_menu[SETTING_STATUS].image_click);						//设置背景图片
			down_menu[SETTING_STATUS].status=true;
		}else
		{
     lv_img_set_src(down_menu[SETTING_STATUS].obj ,down_menu[SETTING_STATUS].image_release);						//设置背景图片
	    down_menu[SETTING_STATUS].status=false;
		}
	}	
	

}
#else
	
//显示弹窗函数

static void msgbox_event_callback(lv_event_t * event)
{
    lv_event_code_t code = lv_event_get_code(event);
    lv_obj_t * msgbox = lv_event_get_current_target(event);
 
    if ((code == LV_EVENT_VALUE_CHANGED) && (msgbox != NULL))
    {
        const char * txt = lv_msgbox_get_active_btn_text(msgbox);
        if((strcmp(txt, "Ok") == 0) || (strcmp(txt, "Quit") ==0 ))
        {
            lv_msgbox_close(msgbox);
        }
    }
}




//显示是否关机提示窗
void Is_ShutDown_Menu()
{
	    static lv_style_t msgbox_style;         //外部样式
      lv_style_init(&msgbox_style);           // 初始化按钮样式
      lv_style_set_radius(&msgbox_style, 20); // 设置样式圆角弧度

	
//        lv_obj_t *window = lv_obj_create(lv_scr_act());
//	      lv_obj_align(window, LV_ALIGN_CENTER, 0, 0);
//	      lv_obj_set_size(window, 280, 150);
//				lv_obj_set_style_bg_color(window, lv_color_make(0,0,0), 0);//设置背景颜色为黑色
//				lv_obj_set_scrollbar_mode(window, LV_SCROLLBAR_MODE_OFF);  //取消滚动条显示
//        lv_obj_set_style_bg_opa(window,LV_OPA_60,0);               //设置透明度


				//lv_obj_set_size(window, LV_HOR_RES, LV_VER_RES);s
        static const char * btns2[] = {"Ok", "Quit",""};

        /* Create the message box as a child of the modal background */
        lv_obj_t * mbox = lv_msgbox_create(lv_scr_act()/*NULL*/, "is Power?",NULL,btns2,false);
        lv_obj_align(mbox, LV_ALIGN_CENTER, 0, 0);
				lv_obj_set_size(mbox, 250, 120);
				lv_obj_align(mbox, LV_ALIGN_CENTER, 0, 0);

				lv_obj_add_style(mbox, &msgbox_style, 0);
				lv_obj_set_style_bg_color(mbox, lv_color_make(0,0,0), 0);//设置背景颜色为黑色
	      lv_obj_set_scrollbar_mode(mbox, LV_SCROLLBAR_MODE_OFF);  //取消滚动条显示
        lv_obj_set_style_bg_opa(mbox,LV_OPA_60,0);               //设置透明度
			
				lv_obj_add_event_cb(mbox, msgbox_event_callback, LV_EVENT_ALL, NULL);
				
				
				
				static lv_style_t title_style;         //外部样式
				lv_style_init(&title_style);         // 初始化样式
				lv_obj_t * title=lv_msgbox_get_title(mbox);  //获取当前的标题
				//lv_style_set_align(&title_style,LV_ALIGN_TOP_MID);
				//lv_obj_align(title, LV_ALIGN_OUT_TOP_MID, 0, 10);
				
			  lv_style_set_text_align(&title_style,LV_TEXT_ALIGN_CENTER);//设置文本的对齐方式居中对齐
				lv_style_set_text_color(&title_style,lv_color_make(0xff,0xff,0xff));  //设置字体颜色
        lv_style_set_text_font(&title_style, &language_36);                   //设置字体
				
				
				
				
				
	if(current_language==LANGUAGE_TYPE_CHINESE)
	{
		lv_label_set_text_fmt(title,"是否关机?");
	}else 
	if(current_language==LANGUAGE_TYPE_ENGLISH)
	{
		lv_label_set_text_fmt(title,"Power Off?");
	}
				
   lv_obj_add_style(title, &title_style, 0);

				
//      lv_obj_set_event_cb(mbox, mbox_event_cb);

   //获取当前的矩阵按键
	
		static lv_style_t btn_style;         //外部样式
		lv_style_init(&btn_style);         // 初始化样式
	
	
   lv_obj_t * btn	= lv_msgbox_get_btns(mbox);
	 lv_obj_set_size(btn,200,50);
	lv_style_set_align(&btn_style,LV_ALIGN_BOTTOM_MID);
	//lv_style_set_height(&btn_style,50);

   lv_obj_add_style(btn, &btn_style, 0);
	 lv_obj_align(btn, LV_ALIGN_BOTTOM_MID, 0, -5);

	
	
	
	
	
	
	
	

}







//事件的回调函数
 void ble_status_btn_event_cb(lv_event_t * event)
{
	  printf("%s\r\n",__FUNCTION__);
		//判断当前的对象
	  lv_obj_t * obj = lv_event_get_target(event);
	
			if(Btn_menu[BLUTOOTH_STATUS].status==false)
		{
			lv_img_set_src(obj ,&blutooth_on);						//设置背景图片
			Btn_menu[BLUTOOTH_STATUS].status=true;
		}else
		{
     lv_img_set_src(obj ,&blutooth_off);						//设置背景图片
	    Btn_menu[BLUTOOTH_STATUS].status=false;
		}
}

	
 void brightness_btn_event_cb(lv_event_t * event)
{
			  //判断当前的对象
	  lv_obj_t * obj = lv_event_get_target(event);
		  printf("%s\r\n",__FUNCTION__);
	
	
		if(Btn_menu[BRIGHTNESS_STATUS].status==false)
		{
			lv_img_set_src(obj ,&brightness_on);						//设置背景图片
			Btn_menu[BRIGHTNESS_STATUS].status=true;
		}else
		{
     lv_img_set_src(obj ,&brightness_off);						//设置背景图片
	    Btn_menu[BRIGHTNESS_STATUS].status=false;
		}

}

	


 void DoNotDisturb_btn_event_cb(lv_event_t * event)
{
		  printf("%s\r\n",__FUNCTION__);
			  //判断当前的对象
	  lv_obj_t * obj = lv_event_get_target(event);
			if(Btn_menu[DO_NOTDISTURB_STATUS].status==false)
		{
			lv_img_set_src(obj ,&DoNotDisturb);						   //设置背景图片
			Btn_menu[DO_NOTDISTURB_STATUS].status=true;
		}else
		{
     lv_img_set_src(obj ,&DoNotDisturb_off);						//设置背景图片
	    Btn_menu[DO_NOTDISTURB_STATUS].status=false;
		}

}

 void power_btn_event_cb(lv_event_t * event)
{
		  printf("%s\r\n",__FUNCTION__);
			  //判断当前的对象
	  lv_obj_t * obj = lv_event_get_target(event);
		Is_ShutDown_Menu();
	#if 0
			if(Btn_menu[POWER_STATUS].status==false)
		{
			Is_ShutDown_Menu();
			lv_img_set_src(obj ,&power_off);						//设置背景图片
			Btn_menu[POWER_STATUS].status=true;
		}else
		{
     lv_img_set_src(obj ,&power_off);						//设置背景图片
	    Btn_menu[POWER_STATUS].status=false;
		}
		#endif

}
 void lock_status_btn_event_cb(lv_event_t * event)
{
 printf("%s\r\n",__FUNCTION__);
	 //判断当前的对象
	  lv_obj_t * obj = lv_event_get_target(event);
			if(Btn_menu[LOCK_STATUS].status==false)
		{
			lv_img_set_src(obj ,&lock_on);						//设置背景图片
			Btn_menu[LOCK_STATUS].status=true;
		}else
		{
     lv_img_set_src(obj ,&lock_off);						//设置背景图片
	    Btn_menu[LOCK_STATUS].status=false;
		}

}
 void setting_btn_event_cb(lv_event_t * event)
{
		  printf("%s\r\n",__FUNCTION__);
			  //判断当前的对象
	  lv_obj_t * obj = lv_event_get_target(event);
	
	  #if 0
	  window_setting_init();
	  #else
	//设置当前的显示主界面为设置界面
   lv_obj_set_tile_id(title_main,window_manger[WINDOW_ADD].col_id, window_manger[WINDOW_ADD].row_id,LV_ANIM_OFF);
		#endif
	
	  #if 0
			if(Btn_menu[SETTING_STATUS].status==false)
		{
			lv_img_set_src(obj ,&setting);						//设置背景图片
			Btn_menu[SETTING_STATUS].status=true;
		}else
		{
     lv_img_set_src(obj ,&setting);						  //设置背景图片
	    Btn_menu[SETTING_STATUS].status=false;
		}
		#endif

}

			

#endif






void window_down_init()
{
	//初始化下拉菜单 静态创建
	#if 0
	for(int i=0;i<sizeof(down_menu)/sizeof(down_menu[0]);i++)
	{
		down_menu[i].obj  = lv_imgbtn_create(window_manger[WINDOW_DOWN].window_obj);
	  lv_obj_set_size(down_menu[i].obj,((lv_img_dsc_t *)(down_menu[i].image_click))->header.w,((lv_img_dsc_t *)(down_menu[i].image_click))->header.h);
    lv_obj_set_pos(down_menu[i].obj ,down_menu[i].xpos,down_menu[i].ypos);        //设置坐标
		if(down_menu[i].status==false)
		{
			lv_img_set_src(down_menu[i].obj ,down_menu[i].image_release);						//设置背景图片
		}else
		{
    lv_img_set_src(down_menu[i].obj ,down_menu[i].image_click);									//设置背景图片
	  }
		lv_obj_add_event_cb(down_menu[i].obj , my_event_cb, LV_EVENT_CLICKED, NULL);	//增加按键处理回调函数
	}
	#else   //动态创建
	
	lv_obj_t *ble_status_btn=NULL; 			
  lv_obj_t *brightness_btn=NULL;			
  lv_obj_t *DoNotDisturb_btn=NULL; 		
  lv_obj_t *lock_status_btn=NULL; 		
  lv_obj_t * power_btn=NULL; 					
  lv_obj_t * setting_btn=NULL; 				

ble_status_btn  	= lv_imgbtn_create(window_manger[WINDOW_DOWN].window_obj);
brightness_btn  	= lv_imgbtn_create(window_manger[WINDOW_DOWN].window_obj);
DoNotDisturb_btn  = lv_imgbtn_create(window_manger[WINDOW_DOWN].window_obj);
lock_status_btn  	= lv_imgbtn_create(window_manger[WINDOW_DOWN].window_obj);
power_btn  				= lv_imgbtn_create(window_manger[WINDOW_DOWN].window_obj);
setting_btn  			= lv_imgbtn_create(window_manger[WINDOW_DOWN].window_obj);
	
lv_obj_set_size(ble_status_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(brightness_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(DoNotDisturb_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(lock_status_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(power_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(setting_btn,blutooth_on.header.w,blutooth_on.header.h);

    lv_obj_set_pos(ble_status_btn				,70+0*80,100+0*62										);        //设置坐标
		lv_obj_set_pos(brightness_btn				,70+1*80,100+0*62										);        //设置坐标
		lv_obj_set_pos(DoNotDisturb_btn			,70+2*80,100+0*62										);        //设置坐标
		lv_obj_set_pos(lock_status_btn			,70+0*80,100+1*80										);        //设置坐标
		lv_obj_set_pos(power_btn						,70+1*80,100+1*80										);        //设置坐标
		lv_obj_set_pos(setting_btn					,70+2*80,100+1*80										);        //设置坐标
	
	
	  lv_img_set_src(ble_status_btn   ,&blutooth_off);						//设置背景图片
		lv_img_set_src(brightness_btn   ,&brightness_off);					//设置背景图片
		lv_img_set_src(DoNotDisturb_btn ,&DoNotDisturb_off);			//设置背景图片
		lv_img_set_src(lock_status_btn  ,&lock_off);						  //设置背景图片
		lv_img_set_src(power_btn        ,&power_off);						        //设置背景图片
		lv_img_set_src(setting_btn      ,&setting);						        //设置背景图片

	
	
lv_obj_add_event_cb(ble_status_btn   , ble_status_btn_event_cb, LV_EVENT_CLICKED, NULL);	//增加按键处理回调函数
lv_obj_add_event_cb(brightness_btn   , brightness_btn_event_cb, LV_EVENT_CLICKED, NULL);	//增加按键处理回调函数
lv_obj_add_event_cb(DoNotDisturb_btn , DoNotDisturb_btn_event_cb, LV_EVENT_CLICKED, NULL);	//增加按键处理回调函数
//lv_obj_add_event_cb(lock_status_btn  , lock_status_btn_event_cb, LV_EVENT_CLICKED, NULL);	//增加按键处理回调函数
//lv_obj_add_event_cb(power_btn        , power_btn_event_cb, LV_EVENT_CLICKED, NULL);	//增加按键处理回调函数
//lv_obj_add_event_cb(setting_btn      , setting_btn_event_cb, LV_EVENT_CLICKED, NULL);	//增加按键处理回调函数

	
				
	#endif
	

	//显示FREQCHIP
	lv_obj_t* label = lv_label_create(window_manger[WINDOW_DOWN].window_obj); // 创建一个标签，用于显示滑块的滑动值
	if (label != NULL)
	{
		
				lv_label_set_recolor(label, true);                        /*Enable re-coloring by commands in the text*/
				lv_label_set_text_fmt(label, "#ffffff FREQCHIP\n #");
				lv_obj_align(label, LV_ALIGN_TOP_MID,0,20);
	}
	//显示时间
	current_time = lv_label_create(window_manger[WINDOW_DOWN].window_obj); // 创建一个标签，
	if (current_time != NULL)
	{
				lv_label_set_recolor(current_time, true);                        /*Enable re-coloring by commands in the text*/
		    lv_label_set_text_fmt(current_time, "#ffffff %2d:%2d#",My_time.hour,My_time.minute);
				lv_obj_align(current_time, LV_ALIGN_BOTTOM_MID,0,-10);
	}

	//显示汉字
//			lv_obj_t*  logo = lv_label_create(window_manger[WINDOW_DOWN].window_obj); // 创建一个标签，用于显示滑块的滑动值
//			lv_label_set_recolor(logo, true);                        /*Enable re-coloring by commands in the text*/
//		  lv_obj_set_style_text_font(logo, &language_36, 0);
//	    //lv_label_set_text_fmt(logo, "#ffffff 设置Setting#");
//		  lv_label_set_text_fmt(logo,"#ffffff 富芮坤微电子#");
//	    lv_obj_align(logo, LV_ALIGN_BOTTOM_MID,0,-50);
	        //lv_obj_set_pos(logo,20,50);
	
	//ABCDEFJHIJKLMNOBQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
	printf(" size =%d\r\n",os_get_free_heap_size());
}





void window_down_init_dystatic(lv_obj_t *parent)
{
	#if 0
//动态创建
	
	lv_obj_t *ble_status_btn=NULL; 			
  lv_obj_t *brightness_btn=NULL;			
  lv_obj_t *DoNotDisturb_btn=NULL; 		
  lv_obj_t *lock_status_btn=NULL; 		
  lv_obj_t * power_btn=NULL; 					
  lv_obj_t * setting_btn=NULL; 				

ble_status_btn  	= lv_imgbtn_create(parent);
brightness_btn  	= lv_imgbtn_create(parent);
DoNotDisturb_btn  = lv_imgbtn_create(parent);
lock_status_btn  	= lv_imgbtn_create(parent);
power_btn  				= lv_imgbtn_create(parent);
setting_btn  			= lv_imgbtn_create(parent);
	
lv_obj_set_size(ble_status_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(brightness_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(DoNotDisturb_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(lock_status_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(power_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(setting_btn,blutooth_on.header.w,blutooth_on.header.h);

    lv_obj_set_pos(ble_status_btn				,70+0*80,100+0*62										);        //设置坐标
		lv_obj_set_pos(brightness_btn				,70+1*80,100+0*62										);        //设置坐标
		lv_obj_set_pos(DoNotDisturb_btn			,70+2*80,100+0*62										);        //设置坐标
		lv_obj_set_pos(lock_status_btn			,70+0*80,100+1*80										);        //设置坐标
		lv_obj_set_pos(power_btn						,70+1*80,100+1*80										);        //设置坐标
		lv_obj_set_pos(setting_btn					,70+2*80,100+1*80										);        //设置坐标
	
	
	  lv_img_set_src(ble_status_btn   ,&blutooth_off);						//设置背景图片
		lv_img_set_src(brightness_btn   ,&brightness_off);					//设置背景图片
		lv_img_set_src(DoNotDisturb_btn ,&DoNotDisturb_off);			//设置背景图片
		lv_img_set_src(lock_status_btn  ,&lock_off);						  //设置背景图片
		lv_img_set_src(power_btn        ,&power_off);						        //设置背景图片
		lv_img_set_src(setting_btn      ,&setting);						        //设置背景图片

	
	
lv_obj_add_event_cb(ble_status_btn   , ble_status_btn_event_cb, LV_EVENT_CLICKED, NULL);	//增加按键处理回调函数
lv_obj_add_event_cb(brightness_btn   , brightness_btn_event_cb, LV_EVENT_CLICKED, NULL);	//增加按键处理回调函数
lv_obj_add_event_cb(DoNotDisturb_btn , DoNotDisturb_btn_event_cb, LV_EVENT_CLICKED, NULL);//增加按键处理回调函数
//lv_obj_add_event_cb(lock_status_btn  , lock_status_btn_event_cb, LV_EVENT_CLICKED, NULL);	//增加按键处理回调函数
//lv_obj_add_event_cb(power_btn        , power_btn_event_cb, LV_EVENT_CLICKED, NULL);	      //增加按键处理回调函数
//lv_obj_add_event_cb(setting_btn      , setting_btn_event_cb, LV_EVENT_CLICKED, NULL);	    //增加按键处理回调函数
#else




//动态创建
	
	lv_obj_t *ble_status_btn=NULL; 			
  lv_obj_t *brightness_btn=NULL;			
  lv_obj_t *DoNotDisturb_btn=NULL; 		
  lv_obj_t *lock_status_btn=NULL; 		
  lv_obj_t * power_btn=NULL; 					
  lv_obj_t * setting_btn=NULL; 				

ble_status_btn  	= lv_img_create(parent);
brightness_btn  	= lv_img_create(parent);
DoNotDisturb_btn  = lv_img_create(parent);
lock_status_btn  	= lv_img_create(parent);
power_btn  				= lv_img_create(parent);
setting_btn  			= lv_img_create(parent);
	
lv_obj_set_size(ble_status_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(brightness_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(DoNotDisturb_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(lock_status_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(power_btn,blutooth_on.header.w,blutooth_on.header.h);
lv_obj_set_size(setting_btn,blutooth_on.header.w,blutooth_on.header.h);

    lv_obj_set_pos(ble_status_btn				,10+0*80,70+0*62										);        //设置坐标
		lv_obj_set_pos(brightness_btn				,10+1*80,70+0*62										);        //设置坐标
		lv_obj_set_pos(DoNotDisturb_btn			,10+2*80,70+0*62										);        //设置坐标
		lv_obj_set_pos(lock_status_btn			,10+0*80,70+1*80										);        //设置坐标
		lv_obj_set_pos(power_btn						,10+1*80,70+1*80										);        //设置坐标
		lv_obj_set_pos(setting_btn					,10+2*80,70+1*80										);        //设置坐标
	
	
	  lv_img_set_src(ble_status_btn   ,&blutooth_off);						//设置背景图片
		lv_img_set_src(brightness_btn   ,&brightness_off);					//设置背景图片
		lv_img_set_src(DoNotDisturb_btn ,&DoNotDisturb_off);			//设置背景图片
		lv_img_set_src(lock_status_btn  ,&lock_off);						  //设置背景图片
		lv_img_set_src(power_btn        ,&power_off);						        //设置背景图片
		lv_img_set_src(setting_btn      ,&setting);						        //设置背景图片

lv_obj_add_flag(ble_status_btn,LV_OBJ_FLAG_CLICKABLE ); //增加可以点击的属性
lv_obj_add_state(ble_status_btn,LV_STATE_PRESSED);	
lv_obj_add_event_cb(ble_status_btn   , ble_status_btn_event_cb, LV_EVENT_CLICKED, NULL);	//增加按键处理回调函数

lv_obj_add_flag(brightness_btn,LV_OBJ_FLAG_CLICKABLE ); //增加可以点击的属性
lv_obj_add_state(brightness_btn,LV_STATE_PRESSED);
lv_obj_add_event_cb(brightness_btn   , brightness_btn_event_cb, LV_EVENT_CLICKED, NULL);	//增加按键处理回调函数

lv_obj_add_flag(DoNotDisturb_btn,LV_OBJ_FLAG_CLICKABLE ); //增加可以点击的属性
lv_obj_add_state(DoNotDisturb_btn,LV_STATE_PRESSED);
lv_obj_add_event_cb(DoNotDisturb_btn , DoNotDisturb_btn_event_cb, LV_EVENT_CLICKED, NULL);//增加按键处理回调函数

lv_obj_add_flag(lock_status_btn,LV_OBJ_FLAG_CLICKABLE ); //增加可以点击的属性
lv_obj_add_state(lock_status_btn,LV_STATE_PRESSED);
lv_obj_add_event_cb(lock_status_btn  , lock_status_btn_event_cb, LV_EVENT_CLICKED, NULL);	//增加按键处理回调函数

lv_obj_add_flag(power_btn,LV_OBJ_FLAG_CLICKABLE ); //增加可以点击的属性
lv_obj_add_state(power_btn,LV_STATE_PRESSED);
lv_obj_add_event_cb(power_btn        , power_btn_event_cb, LV_EVENT_CLICKED, NULL);	      //增加按键处理回调函数

lv_obj_add_flag(setting_btn,LV_OBJ_FLAG_CLICKABLE ); //增加可以点击的属性
lv_obj_add_state(setting_btn,LV_STATE_PRESSED);
lv_obj_add_event_cb(setting_btn      , setting_btn_event_cb, LV_EVENT_CLICKED, NULL);	    //增加按键处理回调函数





	
				
#endif
	

	//显示FREQCHIP
	lv_obj_t* label = lv_label_create(parent); // 创建一个标签，用于显示滑块的滑动值
	if (label != NULL)
	{
		
				lv_label_set_recolor(label, true);                        /*Enable re-coloring by commands in the text*/
				lv_label_set_text_fmt(label, "#ffffff FREQCHIP\n #");
				lv_obj_align(label, LV_ALIGN_TOP_MID,0,20);
	}
	//显示时间
	 current_time = lv_label_create(parent); // 创建一个标签，
	if (current_time != NULL)
	{
				lv_label_set_recolor(current_time, true);                        /*Enable re-coloring by commands in the text*/
		    lv_label_set_text_fmt(current_time, "#ffffff %2d:%2d#",My_time.hour,My_time.minute);
				lv_obj_align(current_time, LV_ALIGN_BOTTOM_MID,0,-10);
	}

//	//显示汉字
//			lv_obj_t*  logo = lv_label_create(parent); // 创建一个标签，用于显示滑块的滑动值
//			lv_label_set_recolor(logo, true);                        /*Enable re-coloring by commands in the text*/
//		  lv_obj_set_style_text_font(logo, &language_36, 0);
//	    //lv_label_set_text_fmt(logo, "#ffffff 设置Setting#");
//		  lv_label_set_text_fmt(logo,"#ffffff 富芮坤微电子#");
//	    lv_obj_align(logo, LV_ALIGN_BOTTOM_MID,0,-50);
//	     //lv_obj_set_pos(logo,20,50);
	
	//ABCDEFJHIJKLMNOBQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
	printf(" size =%d\r\n",os_get_free_heap_size());
}

